<script>
    $(function(){
        $(".btn").on("click",function(){
            var $this = $(this), $action = $this.data("action"), $src = $this.data("src"),$confirm = $this.data("confirm");
            if ( $confirm && !confirm($confirm) ) {
                return;
            }
            switch ($action){
                case "redirect":
                    if ($src){
                        window.location.href = $src;
                    }else {
                        console.log("无src值");
                    }
                    break;
                default:
                    console.log("无操作");
            }
        });
    });
</script>
